package liuch.learnjdbc.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import liuch.learnjdbc.service.IBusinessService;
import liuch.learnjdbc.service.IOrderService;
import liuch.learnjdbc.service.IStroageService;

/**
 * @author: liuchenhui
 * @create: 2019-08-01 12:17
 **/
@Service
public class BusinessServiceImpl implements IBusinessService {
    @Autowired
    IOrderService orderService;
    @Autowired
    IStroageService stroageService;

    @Override
    @Transactional
    public void doBusiness() {
        orderService.addOrder();
        boolean flag = false;
        if (!flag) {
            throw new RuntimeException();
        }
        stroageService.abatementStroage();
    }
}
